using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace Daniel.Core.Models.Mapping
{
    public class AffiliateMap : EntityTypeConfiguration<Affiliate>
    {
        public AffiliateMap()
        {
            // Primary Key
            this.HasKey(t => t.Id);

            // Properties
            // Table & Column Mappings
            this.ToTable("Affiliate");
            this.Property(t => t.Id).HasColumnName("Id");
            this.Property(t => t.AddressId).HasColumnName("AddressId");
            this.Property(t => t.Deleted).HasColumnName("Deleted");
            this.Property(t => t.Active).HasColumnName("Active");

            // Relationships
            this.HasRequired(t => t.Address)
                .WithMany(t => t.Affiliates)
                .HasForeignKey(d => d.AddressId);

        }
    }
}
